package org.example.pdf;

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.io.FileInputStream;
import java.security.Security;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;

public class CFCAUtils {
    static {
        Security.addProvider(new BouncyCastleProvider());
    }

    public static X509Certificate loadCertificate(String certPath) throws Exception {
        CertificateFactory certFactory = CertificateFactory.getInstance("X.509", "BC");
        try (FileInputStream fis = new FileInputStream(certPath)) {
            return (X509Certificate) certFactory.generateCertificate(fis);
        }
    }
}